package com.dt76.smallloanbackendservice.controller.zjs;

import com.dt76.smallloanbackendservice.service.zjs.LebalService;
import com.dt76.smallloanbackendservice.service.zjs.PowerService;
import com.dt76.smallloanbackendservice.utils.Page;
import com.dt76.smallloanbackendservice.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;


@Controller
@RequestMapping("/zjs")
public class LebalController {

    @Autowired
    private LebalService lebalService;

    @RequestMapping("/qryPageLebal")
    @ResponseBody
    public Page qryPageAllLebal(@RequestParam("pageIndex") int pageIndex
                                    ){
        return lebalService.qryPageAllLebal(pageIndex); }

    @RequestMapping("/delLebal")
    @ResponseBody
    public Result delLebal(@RequestParam("userId")int userId ){

        System.out.println("进入删除方法");
        try {
            lebalService.delBlackUser(userId);
            return new Result(true,"删除成功>>>");
        } catch (Exception e) {
            return new Result(false,"删除失败>>>");
        }

    }
    @RequestMapping("/udpLebal")
    @ResponseBody
    public Result udpLebal(@RequestParam("userId")int userId,
                           @RequestParam("lebal") String lebal){

        System.out.println("进入删除方法");
        try {
            lebalService.udpLebal(userId,lebal);
            return new Result(true,"修改成功>>>");
        } catch (Exception e) {
            return new Result(false,"修改失败>>>");
        }

    }
}
